package com.lzy.wzy.service;

import com.github.pagehelper.PageInfo;
import com.lzy.wzy.model.*;
import com.lzy.wzy.result.Result;
import com.lzy.wzy.vo.*;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;

public interface WorkOrderService {

    //添加工单
    Result<T> doAddWorkOrder(WorkOrderBean workOrderBean);


    //查询所有工单
    Result<PageInfo<WorkOrderVo>> doQueryAllWorkOrder(Integer pageSize, Integer pageNum);

    //文本框查询工单
    Result<PageInfo<WorkOrderVo>> doSearch(Integer pageSize,Integer pageNum,String searchValue);


    //根据工单号修改工单
    Result<T> doModifyWorkOrderByNo(ModifyWorkOrderBean workOrderBean);

    //历史时间记录查询工单
    Result<PageInfo<WorkOrderVo>> doSearchHistoricalTickets(Integer pageSize,Integer pageNum,String historicalTime);

    //批量修改工单
    Result<T> doBatchModifyWorkOrder(List<ModifyWorkOrderBean> workOrderBeans);

    //通过工单状态获取工单
    Result<PageInfo<WorkOrderVo>> doQueryWorkOrdersThroughWorkOrderStatus(Integer pageSize,Integer pageNum,String status);


    //特殊工单结案
    Result<T> doWorkOrderSettlement(String workOrderNumber);
    //反结案工单
    Result<T> reserveWorkOrder(String workOrderNumber);

    //反完工工单
    Result<T> doAntiFinishedWorkOrder(String workOrderNumber);


    //获取半年内审批结果
    Result<PageInfo<ApprovalResultsVo>> doObtainTheApprovalResultsWithinHalfAYear(int pageNum,int pageSize);

    //获取审批详情
    Result<ApprovalDetailsVo> doGetApprovalDetails(int  id);

    //获取所有待处理的异常工单信息
    Result<List<PendingExceptionInfoVo>> doGetAllPendingExceptionInfo(String workOrderNumber);

    //获取工单所有待确认异常信息
    Result<List<ConfirmedExceptionInfoVo>> doGetAllExceptionInfoByStatus(String workOrderNumber,String status);

    //异常工单处理
    Result<T> doExceptionWorkOrderHandling(int id, String program, MultipartFile file,String workOrderNumber) throws Exception;

    //执行确认
    Result<T> doExecutionConfirmation(int id,String exeResult);

    //最终确认
    Result<T> doFinalConfirmation(int id,String workOrderNumber);

    //获取所有已确认的异常信息
    Result<List<HistoryExceptionVo>> doGetAllConfirmedExceptionInformation(String workOrderNumber);

    //异常工单信息查询
    Result<List<HistoryExceptionVo>> doExceptionInformationQuery(String searchValue);

    //删除工单
    Result<T> doDeleteWorkOrder(String workOrderNumber);

    Result<List<ApprovalResultsVo>> doGetApprovalResult();

    //下载附件
    void doDownloadAttachments(HttpServletResponse Result,int id , int idf) throws IOException;

    //转让
    Result<T> doTransfer(int id);

    //上报重大异常
    Result<T> doReportAMajorException(String workOrderNumber,int id);

    Result<String> doGetFileSuffix(int id , int idf);

    //获取审批人签字
    Result<List<ApproveSignVo>> doObtainTheSignatureOfTheApprover(String workOrderNumber);

    //获取所有工单号
    Result<List<String>> doObtainAllOutstandingWorkOrderNumbers();

    //获取工单部分信息
    Result<WorkOrderPartInfo> doObtainPartOfWorkOrderInformation(String workOrderNumber);

    //获取所有项目编号
    Result<List<KeyValueVo>> doGetAllProjectNumber();

    //获取项目名称
    Result<String> doGetProjectInfo(String projectNumber);

    //保存项目工时信息
    Result<T> doSaveProjectInfo(OutOfHoursStatisticsBean outOfHoursStatisticsBean);

    //保存管理工时信息
    Result<T> doSaveAttTime(ProductionManagementHoursBean productionManagementHoursBean);
    //获取所有生产工时信息
    Result<PageInfo<WorkingHoursVo>> doObtainProductionTimeInformation(int pageNum,int pageSize);
    //保存生产工时信息
    Result<T> doSaveProductionTimeInformation(WorkingHoursVo workingHoursVo);

    //获取所有非生产项目工时信息
    Result<PageInfo<OutOfHoursStatisticsVo>> doObtainTimeInformationOfAllProjects(int pageNum, int pageSize);
    //保存生产工时信息

    //根据工单号查询生产工时信息
    Result<PageInfo<WorkingHoursVo>> doQueryHoursByWorkNumber(String workOrderNumber,int pageNum,int pageSize);

    //按月统计生产工时
    Result<StatisticsHoursResultVo> doMonthlyStatisticsOfProductionHours(int year,int month);

    //按月统计项目工时
    Result<StatisticsHoursResultVo> doMonthlyStatisticsOfProjectHours(int year,int month);

    //按年统计生产工时
    Result<StatisticsHoursResultVo> doYearStatisticsOfProjectHours(int year);

    //按项目号统计月生产工时
    Result<StatisticsHoursResultVo> doProjectNumberMonthStatisticsOfProjectHours(String projectNumber,int year,int month);

    //按项目号统计年生产工时
    Result<StatisticsHoursResultVo> doProjectNumberYearStatisticsOfProjectHours(String projectNumber,int year);

    //按年统计生产工时
    Result<StatisticsHoursResultVo> doYearStatisticsOfProductionHours(int year);

    //按工单查询月生产工时
    Result<StatisticsHoursResultVo> doWorkOrderNumberMonthStatisticsOfProductionHours(String workOrderNumber,int year,int month);

    //按工单查询年生产工时
    Result<StatisticsHoursResultVo> doWorkOrderNumberYearStatisticsOfProductionHours(String workOrderNumber,int year);

    //通过项目编号或者项目名称查询项目信息
    Result<PageInfo<OutOfHoursStatisticsVo>> doQueryProjectInformationByProjectNumberOrProjectName(String searchValue,int pageNum,int pageSize);

    //删除项目
    Result<T> doDeleteProject(String projectNumber);

    //添加项目
    Result<T> doAddProject(String projectNumber,String projectName);

    Result<String> doGetProjectInfoByProjectNumber(String projectNumber);

    //统计管理月工时
    Result<StatisticsHoursResultVo> doManageTimeStatisticsByMonth(int year,int month,int idf);

    //统计管理年工时
    Result<StatisticsHoursResultVo> doManageTimeStatisticsByYear(int year,int idf);

    //通过项目名称统计管理月工时
    Result<StatisticsHoursResultVo> doMonthlyManagementTimeStatisticsByNumber(String projectNumber,int year,int month,int idf);

    //通过项目名称统计管理年工时
    Result<StatisticsHoursResultVo> doYearManagementTimeStatisticsByNumber(String projectNumber,int year,int idf);

    //所有人管理工时导出
    void doAllThePeopleManagementTimeReport(int idf,int year,int month,HttpServletResponse Result) throws IOException;

    //个人管理工时导出
    void doPersonalManagementTimeReport(int idf,int year,int month,HttpServletResponse Result)throws IOException;

    Result<PageInfo<ManageWorkingTimeVo>> doQueryAllManagementTimeInformationOfAnIndividual(int pageNum,int pageSize);

    Result<PageInfo<ManageWorkingTimeVo>> doQueryAllManagementTimeInformationOfAnIndividualByProjectNumber(int pageNum,int pageSize,String projectNumber,String jobNumber);

    Result<PageInfo<ManageWorkingTimeVo>> doQueryAllManagementTimeInformationOfAnIndividualByJobNumber(int pageNum,int pageSize,String jobNumber);
//
//    Result<HoursStaticsVo> doAnnualStatisticsOfProductionHoursByNumber(String workOrderNumber);

    //年生产工时导出
    void doExportOfAnnualProductionHours(int year,HttpServletResponse Result)throws IOException;


    //月生产工时导出
    void doExportOfMonthlyProductionHours(int year,int month,HttpServletResponse Result) throws IOException;


    //年项目工时导出
    void doExportOfAnnualProjectHours(int year,HttpServletResponse Result)throws IOException;


    //月项目工时导出
    void doExportOfMonthlyProjectHours(int year,int month,HttpServletResponse Result) throws IOException;

    //年管理工时导出
    void doExportPersonalOfAnnualManagementHours(int year,String jobNumber,HttpServletResponse Result)throws IOException;

    //月管理工时导出
    void doExportPersonalOfMonthlyManagementHours(int year,int month,String jobNumber,HttpServletResponse Result) throws IOException;
    //根据工单查询部分信息
    Result<IndexVo> doInit();

    //删除生产工时
    Result<T> doAccordingToDeleteProductionHours(int id);

    //删除非生产工时
    Result<T> doAccordingToDeleteNonProductionHours(int id);

    //删除管理工时
    Result<T> doAccordingToDeleteManagementHours(int id);

    //通过时间查询个人管理工时信息
    Result<PageInfo<ManageWorkingTimeVo>> doGetCurMonthManageWorkingHoursInfo(String time,int pageNum,String val);

    Result<List<TicketVo>> doGetSearchInfo(String val);

    Result<Set<String>> doGetVideoLink();
}
